// 导入 http 模块
import http from 'wechat-http'
http.baseURL = 'https://live-api.itheima.net'
// 请求拦截器
http.intercept.request = (config) => {
  let app=getApp();
  if(app.token){
    config.header={
      Authorization:`Bearer ${app.token}`
    }
  }
  return config
}
// 响应拦截器
http.intercept.response = (res) => {
  // 过滤接口返回的数据
  return res.data
}
wx.http = http

export default http
